<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="res.html" %>
<!doctype html>
<html>
<head>
    <title>详情</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <style>
        .form-wrapper {
            width: 100%;
            height: 200px;
        }

        .form-wrapper div {
            width: 200px;
            height: 20px;
            margin: 100px auto;
        }

        button {
            width: 100%;
        }
    </style>
</head>
<body>
<div class="form-wrapper">
    <div>
        <form id="editForm">
            <div class="form-group">
                <label for="exampleInputAddress1">地址</label>
                <input name="address" type="text" value="${resume.address}" class="form-control" id="exampleInputAddress1">
            </div>
            <div class="form-group">
                <label for="exampleInputName1">姓名</label>
                <input name="name" type="text" value="${resume.name}" class="form-control" id="exampleInputName1">
            </div>
            <div class="form-group">
                <label for="exampleInputPhone1">手机号</label>
                <input name="phone" type="text" value="${resume.phone}" class="form-control" id="exampleInputPhone1">
            </div>
            <button type="button" class="btn btn-secondary" onclick="submitInfo()">提交</button>

            <input id="id" type="hidden" name="id" value="${resume.id}" />
            <input id="editType" type="hidden" name="editType" value="${editType}" />
            <input id="actionType" type="hidden" name="actionType" value="" />
            <input id="methodType" type="hidden" name="_method" value="" />
        </form>
    </div>
</div>
<script>
    var editForm = document.getElementById("editForm");
    var editType = document.getElementById("editType");
    var methodType = document.getElementById("methodType");
    var actionType = document.getElementById("actionType");
    var id = document.getElementById("id");

    function submitInfo() {
        if (editType.value === "add") {
            methodType.value = "post";
            actionType.value = "do";
            editForm.setAttribute("action", "/sss/resumes/");
            editForm.setAttribute("method", "post");
            editForm.submit();

        } else if (editType.value === "update") {
            methodType.value = "put";
            actionType.value = "do";
            editForm.setAttribute("action", "/sss/resumes/" + id.value);
            editForm.setAttribute("method", "post");
            editForm.submit();
        }
    }
</script>
</body>
</html>
